import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {UploadTypeEnum} from "@/components/Form/src/jeecg/components/JUpload";
import {render} from "@/utils/common/renderUtils";
//列表数据
export const innerColumns: BasicColumn[] = [
  {
    title: '日期',
    align:"center",
    sorter: true,
    dataIndex: 'createTime',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      return text;
    },
  },
   {
    title: '决策者',
    align:"center",
    dataIndex: 'decisionMaker_dictText'
   },

   {
    title: '方案图片',
    align:"center",
    dataIndex: 'resolutionImg',
     customRender: render.renderImage,
   },
   {
    title: '解决方案',
    align:"center",
    dataIndex: 'resolution'
   },
   {
    title: '方案文件',
    align:"center",
    dataIndex: 'resolutionFile'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },

  {
    title: '处理结果',
    align:"center",
    dataIndex: 'result'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "发起人",
      field: 'finder',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "决策者",
      field: 'decisionMaker',
      component: 'Input',
      //colProps: {span: 6},
 	},
  {
    label: "解决方案",
    field: "resolution",
    component: 'JInput',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '决策者',
    field: 'decisionMaker',
    component: 'UserSelect',
    componentProps: {
      rowKey: 'username',
      labelKey: 'realname',
      maxSelectCount: 10,
    },
  },

  {
    field: 'resolution',
    label: '解决方案',
    component: 'JInputPop',

  },

  {
    field: 'resolutionImg',
    component: 'JUpload',
    label: '方案图片',
    helpMessage: '无限制上传',
    componentProps: {
      fileType: UploadTypeEnum.image,

    },
  },

  {
    field: 'resolutionFile',
    component: 'JUpload',
    helpMessage: '方案文件',
    label: '方案文件',
  },

  {
    label: '处理结果',
    field: 'result',
    component: 'RadioGroup',
    componentProps: {
      //options里面由一个一个的radio组成,支持disabled
      options: [
        { label: '已废弃', value: '已废弃' },
        { label: '使用中', value: '使用中' },
      ],
    },
  },

	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  finder: {title: '发起人',order: 0,view: 'text', type: 'string',},
  decisionMaker: {title: '决策者',order: 1,view: 'text', type: 'string',},
  result: {title: '处理结果',order: 2,view: 'text', type: 'string',},
  resolutionImg: {title: '方案图片',order: 3,view: 'text', type: 'string',},
  resolution: {title: '解决方案',order: 4,view: 'text', type: 'string',},
  resolutionFile: {title: '方案文件',order: 5,view: 'text', type: 'string',},
  remark: {title: '备注',order: 6,view: 'text', type: 'string',},
  reserve: {title: '预留',order: 8,view: 'text', type: 'string',},
  reserve1: {title: '预留1',order: 9,view: 'text', type: 'string',},
  reserve2: {title: '预留2',order: 10,view: 'text', type: 'string',},
  reserve3: {title: '预留3',order: 11,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
